//
//  BuyOrderTableViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/17.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "BuyOrderTableViewCell.h"
#import "GoodsInformationViewController.h"
#import "ATBReFundListModel.h"

@interface BuyOrderTableViewCell ()

@property (strong, nonatomic) UIImageView *timeIV;
@property (strong, nonatomic) UILabel *timeL;
@property (strong, nonatomic) UILabel *statusL;
@property (strong, nonatomic) UIImageView *goodsIV;
@property (strong, nonatomic) UILabel *nameL;
@property (strong, nonatomic) UIImageView *moneyLogoIV;
@property (strong, nonatomic) UILabel *moneyL;
@property (strong, nonatomic) UIImageView *countIV;
@property (strong, nonatomic) UILabel *countL;
@property (strong, nonatomic) UILabel *totolMoneyL;

@property (strong, nonatomic) UIImageView *cancleOrderIV;
@property (strong, nonatomic) UILabel *cancleOrderL;

@property (strong, nonatomic) UIImageView *payOrderIV;
@property (strong, nonatomic) UILabel *payOrderL;

@property (strong, nonatomic) UIImageView *lineIV;

@property (strong, nonatomic) UILabel *rankL;
//合计下边边线
@property (nonatomic , strong)UIView *lineView;
//晒图审核状态
@property (nonatomic , strong)UILabel *statuesLabel;
//区分来自砍价或者是拼团的晒图
@property (nonatomic , strong)UILabel *fromLabel;
@end

@implementation BuyOrderTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.statusL.hidden = YES;
        self.timeIV.hidden = YES;
        
//        [self.contentView addSubview:self.timeIV];
        [self.contentView addSubview:self.timeL];
        [self.contentView addSubview:self.statusL];
        [self.contentView addSubview:self.goodsIV];
        [self.contentView addSubview:self.nameL];
        [self.contentView addSubview:self.moneyLogoIV];
        [self.contentView addSubview:self.moneyL];
        [self.contentView addSubview:self.countIV];
        [self.contentView addSubview:self.countL];
        [self.contentView addSubview:self.totolMoneyL];
        [self.contentView addSubview:self.cancleOrderIV];
        [self.contentView addSubview:self.cancleOrderL];
        [self.contentView addSubview:self.payOrderIV];
        [self.contentView addSubview:self.payOrderL];
        [self.contentView addSubview:self.lineIV];
        
        [self.contentView addSubview:self.rankL];
        [self.contentView addSubview:self.statuesLabel];
        [self.contentView addSubview:self.lineView];
        
        [self.contentView addSubview:self.fromLabel];
    }
    
    return self;
    
}

#pragma mark -立即支付接口
- (void)gotoPay {
    
    NSString *str = [NSString stringWithFormat:@"{\"userid\" : \"%@\", \"money\" : \"%@\", \"ddid\" : \"%@\", \"paytype\" : \"%@\", \"addressid\" : \"%@\", \"kdmoney\" : \"%@\" , \"bean\" : \"%@\"}", [RSA encryptString:[CommonUserInfo sharedInstance].user_id publicKey:PublicKey], [RSA encryptString:self.orderModel.money publicKey:PublicKey], [RSA encryptString:self.orderModel.ddid publicKey:PublicKey], [RSA encryptString:@"1" publicKey:PublicKey], [RSA encryptString:self.orderModel.addressid publicKey:PublicKey], [RSA encryptString:self.orderModel.kdmoney publicKey:PublicKey], [RSA encryptString:self.orderModel.dintegral publicKey:PublicKey]];
    
    WS(weakSelf);
    [[CommonAction sharedInstance] gotoPay:str type:1 andReturnBlock:^(id result) {
        TalkingDataOrder *order = [TalkingDataOrder createOrder:weakSelf.orderModel.ddid total:[weakSelf.orderModel.money floatValue] * 100 currencyType:@"CNY"];
        [order addItem:@"" category:weakSelf.orderModel.classname name:weakSelf.orderModel.title unitPrice:[weakSelf.orderModel.money floatValue] * 100 amount:1];
        [TalkingData onOrderPaySucc:[CommonUserInfo sharedInstance].user_id payType:@"Alipay" order:order];
    }];
    
}

-(void)setRefundModel:(ATBReFundListModel *)refundModel{
    _refundModel = refundModel;
    self.cancleOrderL.hidden = YES;
    self.cancleOrderIV.hidden = YES;
    self.payOrderL.hidden = YES;
    self.payOrderIV.hidden = YES;
    self.timeL.text = refundModel.dianpu;
    
    NSString *picStr = [NSString string];
    if ([refundModel.tpic hasPrefix:@"http://"] || [refundModel.tpic hasPrefix:@"https://"]) {
        picStr = refundModel.tpic;
    }else {
        
        picStr = [NSString stringWithFormat:@"http://%@", refundModel.tpic];
    }
    [self.goodsIV sd_setImageWithURL:[NSURL URLWithString:picStr]];
    
    NSString *str = refundModel.title;
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:str];
    NSMutableParagraphStyle *pargStyle = [[NSMutableParagraphStyle alloc] init];
    [pargStyle setLineSpacing:jisuan(5)];
    [attributeStr addAttribute:NSParagraphStyleAttributeName value:pargStyle range:NSMakeRange(0, str.length)];
    self.nameL.attributedText = attributeStr;
    
    self.moneyL.text = refundModel.price;
    self.countL.text = refundModel.number;
    self.totolMoneyL.text = [NSString stringWithFormat:@"合计：%@", refundModel.money];
    if ([refundModel.active_type intValue] == 1) {
        self.fromLabel.text = @"砍价";
    }else if ([refundModel.active_type intValue] == 2){
        self.fromLabel.text = @"拼团";
    }
    if ([refundModel.status intValue] == 0) {
        self.statuesLabel.text = @"审核中";
    }else if ([refundModel.status intValue] == 1){
        self.statuesLabel.text = @"审核通过";
    }else if ([refundModel.status intValue] == 2){
        self.statuesLabel.text = @"不通过";
    }
    
}

- (void)setOrderModel:(BuyOrderContentModel *)orderModel {
    
    _orderModel = orderModel;
    
    self.timeL.text = orderModel.dianpu;
    
    NSString *picStr = [NSString string];
    if ([orderModel.tpic hasPrefix:@"http://"] || [orderModel.tpic hasPrefix:@"https://"]) {
        
        picStr = orderModel.tpic;
        
    }else {
        
        picStr = [NSString stringWithFormat:@"http://%@", orderModel.tpic];
    }
    
    
    [self.goodsIV sd_setImageWithURL:[NSURL URLWithString:picStr]];
    
    NSString *str = orderModel.title;
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:str];
    NSMutableParagraphStyle *pargStyle = [[NSMutableParagraphStyle alloc] init];
    [pargStyle setLineSpacing:jisuan(5)];
    [attributeStr addAttribute:NSParagraphStyleAttributeName value:pargStyle range:NSMakeRange(0, str.length)];
    self.nameL.attributedText = attributeStr;

//    self.rankL.text = [NSString stringWithFormat:@"分类：%@", orderModel.classname];
    
    self.moneyL.text = orderModel.price;
    NSLog(@"orderModel.kdmoney---- %@",orderModel.kdmoney);
    
    self.countL.text = orderModel.number;
    self.totolMoneyL.text = [NSString stringWithFormat:@"合计：%@", orderModel.money];
    
    
    if (self.type == 1 || self.type == 2) {
        
        self.cancleOrderL.text = @"取消订单";
        self.cancleOrderL.hidden = YES;
        self.cancleOrderIV.hidden = YES;
        
    }else if (self.type == 3) {
        
        self.cancleOrderL.text = @"查看物流";
        self.cancleOrderL.hidden = YES;
        self.cancleOrderIV.hidden = YES;
        
    }else {
        
        self.cancleOrderL.text = @"删除订单";
        self.cancleOrderL.hidden = YES;
        self.cancleOrderIV.hidden = YES;

    }
    
    if (self.type == 1) {
        
        self.payOrderL.text = @"立即支付";
        
    }else if (self.type == 3) {
        
        self.payOrderL.text = @"确认收货";
//        self.payOrderL.hidden = YES;
//        self.payOrderIV.hidden = YES;
        
    }else {
        
        self.payOrderL.text = @"再次购买";
        self.payOrderL.hidden = YES;
        self.payOrderIV.hidden = YES;
    }
    if (self.type == 5) {
        
        if ([orderModel.share_status intValue] == 2) {
            self.statuesLabel.text = @"审核中";
        }else if ([orderModel.share_status intValue] == 4){
            self.statuesLabel.text = @"审核未通过,请重新提交晒图信息";
        }else if ([orderModel.share_status intValue] == 3){
            self.statuesLabel.text = @"审核通过";
        }
        
        if (![orderModel.bargain_id isEqualToString:@""]) {
            self.fromLabel.text = @"砍价";
        }
        if (![orderModel.spid isEqualToString:@""]) {
            self.fromLabel.text = @"拼团";
        }
    }
    
}


#pragma mark -取消订单
- (void)cancleGestureClick:(UIGestureRecognizer *)recognizer {
    
    if ([self.cancleOrderL.text isEqualToString:@"取消订单"]) {
        
        NSLog(@"取消订单");
        
    }else if ([self.cancleOrderL.text isEqualToString:@"删除订单"]) {
        
        NSLog(@"删除订单");
        
    }else {
        
        NSLog(@"查看物流");
        
        GoodsInformationViewController *informationVC = [[GoodsInformationViewController alloc] init];

        [self.parentVC.navigationController pushViewController:informationVC animated:YES];
        
    }
    
}

#pragma mark -立即支付
- (void)payOrderGestureClick:(UIGestureRecognizer *)recognizer {
    
    if ([self.payOrderL.text isEqualToString:@"立即支付"]) {
        
        NSLog(@"立即支付");
        
        [self gotoPay];

        
    }else if ([self.payOrderL.text isEqualToString:@"确认收货"]) {
        
        NSLog(@"确认收货");
        
        NSString *str = [NSString stringWithFormat:@"{\"ddid\" : \"%@\"}", [RSA encryptString:self.orderModel.ddid publicKey:PublicKey]];
        
        [PPNetworkHelper POST:@"qxtorder/order/shouhuo" parameters:@{@"json" : str} success:^(id responseObject) {
            
            NSLog(@"确认收货：%@", responseObject);
            
            if ([responseObject[@"code"] integerValue] == 1) {
                
                [[NSNotificationCenter defaultCenter] postNotificationName:@"NSConfirmReceiptNotification" object:@{@"model" : self.orderModel}];
                
            }else {
                
                [[KYAlertView sharedInstance] showAlertViewWithMessage:responseObject[@"msg"]];
            }
            
            
        } failure:^(NSError *error) {
            
            if (error) {
                
                [[KYAlertView sharedInstance] showAlertViewWithMessage:Tip];
            }
        }];
        
    }else {
        
        NSLog(@"再次购买");
        
    }
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];

    __weak typeof(self) weakSelf = self;
//    [self.timeIV mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(40));
//        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(50));
//        make.width.mas_equalTo(jisuan(30));
//        make.height.mas_equalTo(jisuan(30));
//
//    }];
    
//    [self.timeL mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.left.mas_equalTo(weakSelf.timeIV.mas_right).with.offset(Margin);
//        make.centerY.mas_equalTo(weakSelf.timeIV.mas_centerY);
//
//    }];
    [self.timeL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(Margin);
        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(50));
        
    }];
    [self.fromLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.moneyL);;
        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(50));
        
    }];
    
    [self.statusL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
//        make.centerY.mas_equalTo(weakSelf.timeIV.mas_centerY);
        make.centerY.mas_equalTo(weakSelf.timeL.mas_centerY);
        
    }];
    
    [self.goodsIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(40));
//        make.top.mas_equalTo(weakSelf.timeIV.mas_bottom).with.offset(jisuan(22));
        make.top.mas_equalTo(weakSelf.timeL.mas_bottom).with.offset(jisuan(22));
        make.width.mas_equalTo(jisuan(120));
        make.height.mas_equalTo(jisuan(120));
        
    }];
    
    [self.moneyL sizeToFit];
    [self.moneyL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
        make.top.mas_equalTo(weakSelf.statusL.mas_bottom).with.offset(jisuan(20));
        
//        if (self.moneyL.text) {
//
//            make.width.mas_equalTo(weakSelf.moneyL.width);
//            make.height.mas_equalTo(weakSelf.moneyL.height);
//        }
        
    }];
    
    [self.moneyLogoIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.moneyL.mas_left).with.offset(-jisuan(10));
        make.centerY.mas_equalTo(weakSelf.moneyL.mas_centerY);
        make.width.mas_equalTo(jisuan(14));
        make.height.mas_equalTo(jisuan(18));
    }];
    
    [self.nameL sizeToFit];
    [self.nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.goodsIV.mas_right).with.offset(jisuan(30));
        make.top.mas_equalTo(weakSelf.goodsIV.mas_top);
        make.right.mas_equalTo(weakSelf.moneyLogoIV.mas_left).with.offset(-jisuan(30));
        
        
    }];
    [self.rankL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.nameL.mas_left);
        make.bottom.mas_equalTo(weakSelf.goodsIV.mas_bottom);
    }];
    
    
    [self.countL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
        make.top.mas_equalTo(weakSelf.moneyL.mas_bottom).with.offset(jisuan(22));
        
    }];
    [self.countIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.countL.mas_left).with.offset(-jisuan(10));
        make.centerY.mas_equalTo(weakSelf.countL.mas_centerY);
        make.width.mas_equalTo(jisuan(14));
        make.height.mas_equalTo(jisuan(14));
        
    }];
    
    [self.totolMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(96));
        
    }];
    
    [self.payOrderIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(40));
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(30));
        make.width.mas_equalTo(jisuan(156));
        make.height.mas_equalTo(jisuan(46));
        
    }];
    
    [self.payOrderL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakSelf.payOrderIV.mas_centerY);
        make.centerX.mas_equalTo(weakSelf.payOrderIV.mas_centerX);
        
    }];
    
    [self.cancleOrderIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.payOrderIV.mas_left).with.offset(-jisuan(30));
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(30));
        make.width.mas_equalTo(jisuan(156));
        make.height.mas_equalTo(jisuan(46));
        
    }];
    
    [self.cancleOrderL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakSelf.cancleOrderIV.mas_centerY);
        make.centerX.mas_equalTo(weakSelf.cancleOrderIV.mas_centerX);
        
    }];
    
    [self.lineIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom);
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.width.mas_equalTo(jisuan(714));
        make.height.mas_equalTo(jisuan(4));
    }];
    
    [self.statuesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-10);
          make.centerX.mas_equalTo(0);

        
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(weakSelf.totolMoneyL.mas_bottom).with.offset(jisuan(10));
        make.height.mas_equalTo(jisuan(1));
    make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(0);
    make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(0);
        make.height.mas_equalTo(jisuan(0.5));
    }];
    
    
    
}

#pragma mark -lazy
- (UIImageView *)timeIV {
    
    if (!_timeIV) {
        
        _timeIV = [[UIImageView alloc] init];
        _timeIV.contentMode = UIViewContentModeScaleAspectFit;
        _timeIV.image = [UIImage imageNamed:@"timeBG"];
        
    }
    
    return _timeIV;
}

- (UILabel *)timeL {
    
    if (!_timeL) {
        
        _timeL = [[UILabel alloc] init];
        _timeL.textColor = Color333333;
        _timeL.text = @"2018-06-29 15:12:23";
        _timeL.font = Font(24);
        _timeL.textAlignment = NSTextAlignmentLeft;
        _timeL.backgroundColor = WhiteColor;
        
    }
    
    return _timeL;
}

- (UILabel *)statusL {
    
    if (!_statusL) {
        
        _statusL = [[UILabel alloc] init];
        _statusL.textColor = Colorff4200;
        _statusL.text = @"等待支付";
        _statusL.font = Font(24);
        _statusL.textAlignment = NSTextAlignmentRight;
        _statusL.backgroundColor = WhiteColor;
        
    }
    
    return _statusL;
}

- (UIImageView *)goodsIV {
    
    if (!_goodsIV) {
        
        _goodsIV = [[UIImageView alloc] init];
        _goodsIV.contentMode = UIViewContentModeScaleAspectFit;
        _goodsIV.image = [UIImage imageNamed:@"goodsBG"];
    }
    
    return _goodsIV;
}

- (UILabel *)nameL {
    
    if (!_nameL) {
        
        _nameL = [[UILabel alloc] init];
        _nameL.textColor = Color333333;
        
//        NSString *str = @"理财红包，十块钱;理财红包，十块钱;理财红包，十块钱;理财红包，十块钱;理财红包，十块钱";
//        NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:str];
//        NSMutableParagraphStyle *pargStyle = [[NSMutableParagraphStyle alloc] init];
//        [pargStyle setLineSpacing:jisuan(5)];
//        [attributeStr addAttribute:NSParagraphStyleAttributeName value:pargStyle range:NSMakeRange(0, str.length)];
//        _nameL.attributedText = attributeStr;
        _nameL.numberOfLines = 2;
        _nameL.lineBreakMode = NSLineBreakByCharWrapping;
        
        _nameL.font = Font(24);
        _nameL.textAlignment = NSTextAlignmentLeft;
        _nameL.backgroundColor = WhiteColor;
        
    }
    
    return _nameL;
}

- (UILabel *)moneyL  {
    
    if (!_moneyL) {
        
        _moneyL = [[UILabel alloc] init];
        _moneyL.textColor = Color333333;
//        _moneyL.text = @"99999.00";
        _moneyL.font = Font(24);
        _moneyL.textAlignment = NSTextAlignmentRight;
        _moneyL.backgroundColor = WhiteColor;
        
    }
    
    return _moneyL;
    
}

- (UIImageView *)moneyLogoIV {
    
    if (!_moneyLogoIV) {
        
        _moneyLogoIV = [[UIImageView alloc] init];
        _moneyLogoIV.contentMode = UIViewContentModeScaleAspectFit;
        _moneyLogoIV.image = [UIImage imageNamed:@"moneyLogoBG"];
    }
    
    return _moneyLogoIV;
    
}

- (UILabel *)countL {
    
    if (!_countL) {
        
        _countL = [[UILabel alloc] init];
        _countL.textColor = Color9b9b9b;
        _countL.text = @"1";
        _countL.font = Font(24);
        _countL.textAlignment = NSTextAlignmentRight;
        
        _countL.backgroundColor = WhiteColor;
    }
    
    return _countL;
    
}
- (UIImageView *)countIV {
    
    if (!_countIV) {
        
        _countIV = [[UIImageView alloc] init];
        _countIV.contentMode = UIViewContentModeScaleAspectFit;
        _countIV.image = [UIImage imageNamed:@"countOrderBG"];
    }
    
    return _countIV;
    
}

- (UILabel *)totolMoneyL {
    
    if (!_totolMoneyL) {
        
        _totolMoneyL = [[UILabel alloc] init];
        _totolMoneyL.textColor = Color333333;
        _totolMoneyL.text = @"合计：10.00元";
        _totolMoneyL.font = Font(24);
        _totolMoneyL.textAlignment = NSTextAlignmentRight;
        _totolMoneyL.backgroundColor = WhiteColor;
    }
    
    return _totolMoneyL;
    
}

- (UIImageView *)cancleOrderIV {
    
    if (!_cancleOrderIV) {
        
        _cancleOrderIV = [[UIImageView alloc] init];
        _cancleOrderIV.contentMode = UIViewContentModeScaleAspectFit;
        _cancleOrderIV.image = [UIImage imageNamed:@"canclePurchaseBG"];
        
        _cancleOrderIV.userInteractionEnabled = YES;
        UITapGestureRecognizer *cancleGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cancleGestureClick:)];
        [_cancleOrderIV addGestureRecognizer:cancleGesture];
    }
    
    return _cancleOrderIV;
}
- (UILabel *)cancleOrderL {
    
    if (!_cancleOrderL) {
        
        _cancleOrderL = [[UILabel alloc] init];
//        _cancleOrderL.text = @"取消订单";
        _cancleOrderL.textColor = Color333333;
        _cancleOrderL.font = Font(24);
        _cancleOrderL.textAlignment = NSTextAlignmentCenter;
        _cancleOrderL.backgroundColor = WhiteColor;
        
    }
    
    return _cancleOrderL;
}

- (UIImageView *)payOrderIV {
    
    if (!_payOrderIV) {
        
        _payOrderIV = [[UIImageView alloc] init];
        _payOrderIV.contentMode = UIViewContentModeScaleAspectFit;
        _payOrderIV.image = [UIImage imageNamed:@"purchasePayBG"];
        
        _payOrderIV.userInteractionEnabled = YES;
        UITapGestureRecognizer *payOrderGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(payOrderGestureClick:)];
        [_payOrderIV addGestureRecognizer:payOrderGesture];
        
    }
    
    return _payOrderIV;
}
- (UILabel *)payOrderL {
    
    if (!_payOrderL) {
        
        _payOrderL = [[UILabel alloc] init];
        _payOrderL.textAlignment = NSTextAlignmentCenter;
        _payOrderL.textColor = WhiteColor;
//        _payOrderL.text = @"立即支付";
        _payOrderL.font = Font(24);
        
    }
    
    return _payOrderL;
}
- (UILabel *)rankL {
    
    if (!_rankL) {
        
        _rankL = [[UILabel alloc] init];
        _rankL.textAlignment = NSTextAlignmentLeft;
        _rankL.textColor = Color9b9b9b;
//        _rankL.text = @"分类：地表最美葡萄酒";
        _rankL.font = Font(20);
        
    }
    
    return _rankL;
}

- (UILabel *)statuesLabel {
    
    if (!_statuesLabel) {
        
        _statuesLabel = [[UILabel alloc] init];
        _statuesLabel.textAlignment = NSTextAlignmentLeft;
        _statuesLabel.textColor = Color333333;
        _statuesLabel.font = Font(30);
        
    }
    
    return _statuesLabel;
}

- (UIImageView *)lineIV {
    
    if (!_lineIV) {
        
        _lineIV = [[UIImageView alloc] init];
        _lineIV.contentMode = UIViewContentModeScaleAspectFit;
        _lineIV.image = [UIImage imageNamed:@"purchaseLineBG"];
        
    }
    
    return _lineIV;
}
-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc]init];

        _lineView.backgroundColor = Color9b9b9b;

    }

    return _lineView;
}

- (UILabel *)fromLabel {
    
    if (!_fromLabel) {
        
        _fromLabel = [[UILabel alloc] init];
        _fromLabel.textAlignment = NSTextAlignmentLeft;
        _fromLabel.textColor = Color333333;
        _fromLabel.font = Font(25);
        
    }
    
    return _fromLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
